package test3.dao;

import org.junit.Test;
import test3.bean.Admini;
import test3.dao.impl.AdminiDaoImpl;
import test3.file.FileModel;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class TestAdminiDao {
    private AdminiDao adminiDao= AdminiDaoImpl.createAdminiDaoImpl();

    private FileModel model=new FileModel();

    @Test
    public void testGetAll(){
        System.out.println(adminiDao.getAllAdminis());
    }

    @Test
    public void testAdd(){

        List<Admini> admini=new ArrayList<>(){{
            add(new Admini("10838","1355"));
            add(new Admini("1038","157"));
            add(new Admini("1034","457"));
            add(new Admini("78945","1235"));
        }};


        for (int i=0;i<admini.size();i++){
            adminiDao.addAdmini(admini.get(i));
        }

        HashMap<String,String>TestRetrun=adminiDao.getAllAdminis();


        System.out.println(TestRetrun);

        model.saveAdministrators(TestRetrun);

    }
}
